<?php
/*
 *  @author Nicolas Genevaux
 * (c)nige 2008
 */
	$QUESTIONNAIRE_SELECT_ALL = 'SELECT * FROM questionnaire LIMIT 40';
	$QUESTIONNAIRE_SELECT_MATIERE = 'SELECT * FROM questionnaire WHERE identifiantmatiere=$0 AND valide="N" LIMIT 40';
	$QUESTIONNAIRE_SELECT_INMA = 'SELECT * FROM questionnaire WHERE identifiantinscrit=$0 AND identifiantmatiere=$1 AND valide="N" ORDER BY identifiant LIMIT $2,$3';
	$QUESTIONNAIRE_SELECT_INMAEX = 'SELECT * FROM questionnaire WHERE identifiantinscrit=$0 AND identifiantmatiere=$1 AND identifiant=$2 AND valide="N" ORDER BY identifiant LIMIT 0,1';

	//$QUESTIONNAIRE_ADAPTE = 'SELECT * FROM questionnaire WHERE identifiant IN (SELECT identifiantexercice FROM `exercicerealiseage` WHERE ratio<0 AND ratio>0)';
	
	$QUESTIONNAIRE_ADAPTE = 'SELECT * FROM questionnaire WHERE identifiant IN (SELECT identifiantexercice FROM `exercicerealiseage` WHERE ratio>=($2*10) AND ratio<=($2*10+10) AND age IN (SELECT YEAR(NOW())-detailinscrit.datenaissance FROM detailinscrit WHERE identifiant=$1)) AND identifiantmatiere=$0 LIMIT 40';
	$QUESTIONNAIRE_ADAPTE_ALL = 'SELECT * FROM questionnaire WHERE identifiant IN (SELECT identifiantexercice FROM `exercicerealiseage` WHERE ratio>0 AND ratio<100 AND age IN (SELECT YEAR(NOW())-detailinscrit.datenaissance FROM detailinscrit WHERE identifiant=$1)) AND identifiantmatiere=$0 LIMIT 40';

	//SELECT * FROM questionnaire WHERE identifiant IN (SELECT identifiantexercice FROM `exercicerealiseage` WHERE ratio<100 AND ratio>0 AND age IN (SELECT YEAR(NOW())-detailinscrit.datenaissance FROM detailinscrit WHERE identifiant='1')) AND identifiantmatiere='1'

?>
